# Maintainer: Brett Cornwall <ainola@archlinux.org>
# Contributor: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Stefano Facchini <stefano.facchini@gmail.com>
# Contributor: Jonathan Lestrelin <zanko@daemontux.org>
# Contributor: Lucio Zara <pennega@gmail.com>

pkgname=spice-gtk
pkgver=0.42
pkgrel=3
pkgdesc="GTK+ client library for SPICE"
arch=('loong64' 'x86_64')
url="https://www.spice-space.org/"
license=('LGPL2.1')
depends=(
    'acl'
    'cairo'
    'gdk-pixbuf2'
    'glib2'
    'gst-plugins-base'
    'gst-plugins-good'
    'gstreamer'
    'gtk3'
    'json-glib'
    'libcacard'
    'libcap-ng'
    'libepoxy'
    'libjpeg-turbo'
    'libsasl'
    'libsoup3'
    'libusb'
    'libx11'
    'lz4'
    'openssl'
    'opus'
    'phodav'
    'pixman'
    'polkit'
    'spice-protocol'
    'usbredir'
    'wayland'
    'zlib'
)
makedepends=(
    'gobject-introspection'
    'meson'
    'python-six'
    'python-pyparsing'
    'usbutils'
    'vala'
    'wayland-protocols'
)
provides=("spice-glib=$pkgver" "spice-gtk3=$pkgver")
replaces=('spice-glib' 'spice-gtk3')
install=spice-gtk.install
source=("https://www.spice-space.org/download/gtk/$pkgname-$pkgver.tar.xz"{,.sig}
        'remove-gobject-introspection-dep.patch')
sha256sums=('9380117f1811ad1faa1812cb6602479b6290d4a0d8cc442d44427f7f6c0e7a58'
            'SKIP'
            '1a016e9c0a0d0b355993b1b934d02d516c4626a262c2b0048551e00db316cb70')
validpgpkeys=('206D3B352F566F3B0E6572E997D9123DE37A484F') # Victor Toso de Carvalho <me@victortoso.com>

prepare() {
  # https://gitlab.freedesktop.org/spice/spice-gtk/-/merge_requests/117
  patch -Np1 -d $pkgname-$pkgver -i ../remove-gobject-introspection-dep.patch
}

build() {
  arch-meson $pkgname-$pkgver build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
}
